home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / BASE-26.UNT < prev    next >
Text File  |  1996-07-04  |  2KB  |  55 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1996-01-30 ╟─╖
  5.  │  │ FILE NAME   BASE-26 .UNT ║          by          ╘════════════════─ ║ ║
  6.  │  │ LIBRARY     DAS-NB03.PBL ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                .....................................                  ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20. $if 1
  21.   $CODE SEG "DAS_NB03"
  22.   $EVENT               OFF
  23.   $ERROR     ALL       OFF
  24.   $OPTIMIZE  SIZE
  25.   $OPTION    GOSUB     OFF
  26.   $OPTION    CNTLBREAK OFF
  27.   $OPTION    SIGNED    OFF
  28.   $DEBUG     MAP       OFF
  29.   $DEBUG     PATH      OFF
  30.   $DEBUG     UNIT      OFF
  31.   $COMPILE   UNIT
  32. $endif
  33. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  34. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  35. ' PURPOSE: convert numbers from 1 to 676 into base26 lettering
  36. '  PARAMS: Number% = the number to be converted
  37. ' RETURNS: 2 character string from AA to ZZ or !! if out of range
  38. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  39. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  40. FUNCTION fBase26$( BYVAL Number% ) LOCAL PUBLIC
  41.   LOCAL H%, L%
  42.  
  43.   IF ( Number% < 1 ) OR ( Number% > 676 ) THEN
  44.       H% = 33
  45.       L% = 33
  46.     ELSE
  47.       DECR Number%
  48.       H% = ( Number%   \   26 ) + 65
  49.       L% = ( Number%  MOD  26 ) + 65
  50.   END IF
  51.  
  52.   FUNCTION = CHR$(H%,L%)
  53.  
  54. END FUNCTION
  55.